package com.bdqn.vueboot.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bdqn.vueboot.config.R;
import com.bdqn.vueboot.dto.LoginlogDto;
import com.bdqn.vueboot.dto.SuppliesDto;
import com.bdqn.vueboot.entity.Loginlog;
import com.bdqn.vueboot.entity.Supplies;
import com.bdqn.vueboot.service.LoginlogService;
import com.bdqn.vueboot.service.SuppliesService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController
@RequestMapping("loginLog")
@CrossOrigin
@Slf4j
public class LoginlogController  extends ApiController {
    /**
     * 服务对象
     */
    @Resource
    private LoginlogService loginlogService;


    @GetMapping("/page")
    public R list(@RequestParam(value = "pageIndex", required = false, defaultValue = "1") Integer pageIndex,
                  @RequestParam(value = "limit", required = false) Integer limit,
                  @RequestParam(value = "loginlogDate", required = false) String loginlogDate,
                  @RequestParam(value = "loginlogDate1", required = false) String loginlogDate1

    ) {
        log.info(String.valueOf(loginlogDate));
        log.info(String.valueOf(loginlogDate1));

        IPage<Loginlog> page = new Page<>(pageIndex, limit);
        IPage<LoginlogDto> page1 = loginlogService.pages(page,loginlogDate,loginlogDate1);
        return R.success(page1);
    }
}
